<%@page import="cn.school.mybaits.Dao.StudentDao"%>
<%@page import="cn.school.mybaits.xml.MyBatisUtil"%>
<%@page import="org.apache.ibatis.session.SqlSession"%>
<%@page import="cn.school.mybaits.entity.Student"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%!public static List<Student> search() {
		SqlSession session = MyBatisUtil.get();
		StudentDao studentDao = session.getMapper(StudentDao.class);
		List<Student> list = studentDao.search(5);
		MyBatisUtil.close(session);
		return list;
	}%>
	<%
		out.print("<table border='1' align='center' cellpadding='0' cellspacing='0'>");
		out.print(
				"<tr><th>stuno</th><th>sname</th><th>sex</th><th>telephone</th><th>qq</th><th>wechat</th><th>gradeid</th><th>enterdate</th><th>fromcity</th><th>birthday</th><th>address</th><th>pass</th><th>idcardpic</th></tr>");
		List<Student> li = search();
		for (Student s : li) {
			out.print("<tr><td>" + s.getStuno() + "</td><td>" + s.getSname() + "</td><td>" + s.getSex() + "</td><td>"
					+ s.getTelephone() + "</td><td>" + s.getQq() + "</td><td>" + s.getWechat() + "</td><td>"
					+ s.getGradeid() + "</td><td>" + s.getEnterdate() + "</td><td>" + s.getFromcity() + "</td><td>"
					+ s.getBirthday() + "</td><td>" + s.getAddress() + "</td><td>" + s.getPass() + "</td><td>"
					+ s.getIdcardpic() + "</td></tr>");
		}
		out.print("</table>");
	%>

</body>
</html>